package com.unicom.office.util;

public class FileUtil {
    public static String getExtension(String filePath){
        String[] split = filePath.split("\\.");
        String ext = split[split.length - 1].toLowerCase();
        return ext;
    }

    public static String addSuffix(String filePath, String suffix){
        String[] split = filePath.split("\\.");
        if(split.length < 2) {
            throw new RuntimeException("文件名不合法");
        }
        split[split.length - 2] += suffix;
        String join = String.join("", split);
        return join;
    }
}
